<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    //实例属性
    //方法就是值为函数的特殊属性
    //静态方法 类的方法
    class Person{
      age=0
      sex='male'
      getSex=function(){
        console.log(this.sex);
      }
      constructor(name){
        this.name=name
      }
      speak(){
        console.log('某人说话');
      }
      static speak(){
        console.log('人说话');
        //this指向类
        console.log(this);
      }
      static getVerison(){
        return '1.0'
      }
    }
    const p=new Person('a')
    p.getSex()
    Person.speak()
    //静态属性
    Person.version='1.0'
  </script>
</body>
</html>